% FWEAVE v1.30 (May 15, 1993)

\input fwebmac.sty

\Wbegin[]{article}{1em}{1em}{demo4.cts}{{\&}{\|}{\\}{\\}{\\}{\@}{\.}{\.}}

% --- Limbo text from @l ---
\def\x(#1){x^{#1}}
\def\y(#1){y_{#1}}
\def\z(#1,#2){z^{#1}{}_{#2}}
\let\WARRAY\WSUB

% --- Beginning of user's limbo section ---




\WN1.  ARRAY PROCESSING.  This example demonstrates two ways of beautifying
array references in \Fortran\ and~C.  Parenthesized references can be
overloaded with the `\.{@W}'~command, as follows:

\WY \WP\WWW::\|x ${}\.{\\x}{}$\5
\Wc{ Replace references to~\Wshort{x} by the macro~\.{\\x}.}\par
 \WP\WWW::\|y ${}\.{\\y}{}$\par
 \WP\WWW::\|z ${}\.{\\z}{}$\WY\par
 $\WP\Wl::\.{"\\\\def\\\\x(\#1)\{x\^\{\#1\}\}"}{}$\5
\Wc{ Contravariant index.}\par
 $\WP\Wl::\.{"\\\\def\\\\y(\#1)\{y\_\{\#1\}\}"}{}$\5
\Wc{ Covariant index.}\par
 $\WP\Wl::\.{"\\\\def\\\\z(\#1\1\#2)\{z\^\{\#1\}\{\}\_\{\#2\}\}"}{}$\5
\Wc{ Mixed indices.}\WY\par
\fi % End of module 1

\WM2. Bracketed array references are activated by the `\.{-W[}'~command.
(In \Fortran\ \FTANGLE\ always automatically replaces brackets by
parentheses.)  One can redefine the \.{\\WARRAY} macro to get special effects.

\WY $\WP\Wl::\.{"\\\\let\\\\WARRAY\\\\WSUB"}{}$\5
\WC{ Subscript bracketed indices.  (\.{\\WSUB}~is defined in \.{fwebmac.web}.)
}\WY\par
\fi % End of module 2

\WM3. In the following test, carefully note the difference in type size between
the results of parenthesized subscripts and bracketed ones.  To fully
understand why this occurs, study the definition of the \.{\\WXA}~macro in
\.{fwebmac.web}.

\WY\WP \&{program} \1\\{main}\WIN1{0}\2\1\7
\WC{ Test of overloaded identifiers. }\6
${}\x(\|i)$\6
${}\y(\|j)$\6
${}\z(\|i,\39\|j){}$\7
\WC{ Bracketed indexing. }\6
${}\|A\WXA{\|i}$\6
${}\|B\WXA{\\{j\_par}}$\6
${}\|C\WXA{\\{index},\39\\{j\_par}}$\6
${}\|D\WXA{\\{index}\WXA{\\{j\_par}+\WO{1}}}$\6
${}\|E\WXA{\WO{1}+\WO{2}\ast\|i}{}$\7
\WC{ Brackets aren't active inside strings. }\6
${}\.{'a[b]c(d)'}{}$\2\7
\&{end}\7
\LANGUAGE{C}\5
\WC{ Now, an example from C. }\6
$\|a\WXA{\WO{1}}\WXA{\WO{2}}\WXA{\|k};{}$\5
\Wc{ In the source, this is ``\.{a[1][2][k]}''.}\WY\par
\fi % End of module 3

\WN4.  INDEX.
\fi % End of module 4

\input demo4.ndx
\input demo4.mds

\Winfo{"fweave ./demo4 -zdemos.sty -=demo4.tex"}  {"./demo4.web"} {(none)}
 {FORTRAN}

\Wcon
